import CryptoJS from 'crypto-js'
var key = CryptoJS.enc.Latin1.parse('abcdef0123456789')
var iv = CryptoJS.enc.Latin1.parse('abcdef0123456789')
// 加密
function EncryptData(data){
    var srcs = CryptoJS.enc.Utf8.parse(data);
    var enrypted = CryptoJS.AES.encrypt(srcs,key,{
        mode:CryptoJS.mode.ECB,
        padding : CryptoJS.pad.Pkcs7
    })
    return enrypted.toString()
}
// 解密
function DecryptData(data){
    var stime = new Date().getTime();
    var decrypt =CryptoJS.AES.decrypt(data,key,{
        mode:CryptoJS.mode.ECB,
        padding : CryptoJS.pad.Pkcs7
    })
    var result = CryptoJS.enc.Utf8.stringify(decrypt).toString();
    var etime = new Date().getTime();
    return result;
}
export {
    EncryptData,
    DecryptData
}